import {Component, OnInit} from '@angular/core';
import {RechargeService} from '../../recharge.service';
import {ActivatedRoute} from '@angular/router';

@Component({
  selector: 'app-promotion-detail',
  templateUrl: './promotion-detail.component.html',
  styleUrls: ['./promotion-detail.component.scss']
})
export class PromotionDetailComponent implements OnInit {
  detail: any = {};
  tableData = [];

  constructor(
    public rechargeService: RechargeService,
    private activatedRoute: ActivatedRoute,
  ) {
  }

  ngOnInit(): void {

    const id = this.activatedRoute.snapshot.queryParams.id;
    if (id) {
      this.rechargeService.getPromotionDetail(id).then((res: any) => {
        console.log(res);
        if (res.code === 0) {
          // this.formData.type = res.data.promotionInfo.type;
          // this.formData.userType = res.data.promotionInfo.userType;
          // this.formData.name = res.data.promotionInfo.name;
          // this.formData.showCopy = res.data.promotionInfo.showCopy;
          // this.formData.remark = res.data.promotionInfo.remark;
          // this.formData.time = [res.data.promotionInfo.beginTime, res.data.promotionInfo.endTime];
          // this.formData.status = res.data.promotionInfo.status;
          this.detail = res.data;
        }
      });
    }
  }

}
